import axios from 'axios'
import config from './config'
import qs from 'qs'

// axios(config)
class API {
	getList (url,param,option) {
		config.data.Method="get";
    if(param) {
      for(var key in param) {
        console.log("key is", key)
        config.params[key] = param[key];
      }
    }
    if(option) {
      for(var key in option) {
        config[key] = option[key];
      }
    }
		return axios.post(url,{},config);
	}
	getCurrency (param) {
		console.log(config);
		var commonData = Object.create(config);

		config.data.Method="get";
		config.data.CustData.Data = param;
		return axios.post('/Router',{},config);
	}
  getQueryString (name) {
    const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
    const r = window.location.search.substr(1).match(reg)
    if (r != null) return r[2]; return null
  }
}
export default API;
